package cn.mumzone.pos.ui.widgets.others;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * author:        yupeng
 * created on:    2019/7/10 16:28
 * description:   禁止滑动的ViewPager
 */
public class BanScrollViewPager extends ViewPager {

    public BanScrollViewPager(@NonNull Context context) {
        super(context);
    }

    public BanScrollViewPager(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        return false;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        return false;
    }

    @Override
    public void setCurrentItem(int item, boolean smoothScroll) {
        super.setCurrentItem(item, smoothScroll);
    }

    @Override
    public void setCurrentItem(int item) {
        super.setCurrentItem(item, false); // 表示切换的时候，不需要切换事件
    }
}
